package com.sinaapp.kjWeb.Schedule;

import java.util.Calendar;
import java.util.Date;

import org.springframework.stereotype.Service;

import com.sinaapp.kjWeb.pojo.KaiJieUser;

/*
 *auth:徐疆
 *date 2014-1-25 下午4:15:06
 */
@Service("DefaultRunTime")
public class DefaultRunTime implements RunTimeStrategy {

	@SuppressWarnings("deprecation")
	@Override
	public Date getCheckInTime(KaiJieUser user) {
		Date date=new Date();
		date.setHours(6);
		date.setMinutes(0);
		date.setSeconds(0);
		return date;
	}

	@SuppressWarnings("deprecation")
	@Override
	public Date getCheckOutTime(KaiJieUser user) {
		Calendar calendar = Calendar.getInstance();
		Date date = new Date();
		calendar.setTime(date);
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK)-1;
		if(4==dayOfWeek){
			date.setHours(23);
			date.setMinutes(50);
			date.setSeconds(0);
		}else{
			date.setHours(20);
			date.setMinutes(0);
			date.setSeconds(0);
		}
		return date;
	}
	
}

